<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:composition template="/template.xhtml">
        <ui:define name="content">
            <h:form id="formFeedback" prependId="false">
                <p:growl id="msgs"/>


                <p:panel header="List of Feedback" style="text-align: center">
                    <p:dataTable paginator="true" rows="10" value="#{feedbackController.item}" var="item" id="tbl" style="text-align: left">
                        <f:facet name="header">
                            List of Feedback
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Title"/>
                            </f:facet>
                            <h:outputText value="#{item.title}" style="word-break:break-all;"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Content"/>
                            </f:facet>
                            <h:outputText value="#{item.content}" style="word-break:break-all;"/>
                        </p:column>


                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Answer"/>
                            </f:facet>
                            <h:outputText value="#{item.answer}" style="word-break:break-all;"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="User"/>
                            </f:facet>
                            <h:outputText value="#{item.userInfo.userName}" style="word-break:break-all;"/>
                        </p:column>

                      
                        <p:column style="text-align: center">
                            <f:facet name="header">
                                <h:outputText value="Action"></h:outputText>
                            </f:facet>


                            <p:commandButton action="#{feedbackController.prepareView}" title="View" image="ui-icon ui-icon-search" ajax="false" />
                            <p:commandButton action="#{feedbackController.prepareSend}" title="Answer" image="ui-icon ui-icon-pencil" ajax="false" />
                            <p:commandButton actionListener="#{feedbackController.delete}" title="Delete" image="ui-icon ui-icon-close" ajax="false" rendered="#{item.answer == null}">
                                <f:setPropertyActionListener value="#{item}" target="#{feedbackController.current}" />
                            </p:commandButton>
                            
                        </p:column>




                    </p:dataTable>
                </p:panel>


            </h:form>
        </ui:define>
    </ui:composition>
</html>
